const state={
	courseSchedulingDialog: false,
	classroomlist:[],
	teacherlist:[]
	
};
const getters={
	
	isShow(state){  //方法名随意,主要是来承载变化的courseSchedulingDialog的值
       return state.courseSchedulingDialog
    },
    getClassroomlist(state){
   	
   	return state.classroomlist
   },
   getTeacherlist(state){
   	
   	return state.teacherlist;
   }
};

const mutations = {
	show(state) {   //自定义改变state初始值的方法，这里面的参数除了state之外还可以再传额外的参数(变量或对象);
        state.courseSchedulingDialog = true;
    },
    hide(state) {  //同上
        state.courseSchedulingDialog = false;
    },
    setCourseSchedulinglist(state,data){
    	
    	state.courseSchedulinglist=data;
    },
    setClassroomlist(state,data){
    	
    	state.classroomlist=data;
    },
    setTeacherlist(state,data){
    	
    	state.teacherlist=data;
    }
};

const actions = {
	hidecourseSchedulingPanel(context) {  //自定义触发mutations里函数的方法，context与store 实例具有相同方法和属性
        context.commit('hide');
    },
    showcourseSchedulingPanel(context){
    	context.commit('show');
    }
//  showcourseSchedulingPanel(context,campusId) {  //同上注释
//  	
//      
//      	let para={campusId:campusId};
//			api.getClassroomList(para).then(function(data){
//				
//				context.commit('setClassroomlist',data.info);
//				return api.userListByCampus(para);
//				
//			}).then(function(data){
//				context.commit('setTeacherlist',data.userList);				
//				context.commit('show');
//			})
//  }
};

module.exports = {
	  namespaced:true,//用于在全局引用此文件里的方法时标识这一个的文件名
	  state,
	  getters,
	  actions,
	  mutations
}